package com.polarrose.spring.remoting.rest.utils;

import java.lang.reflect.Method;

import com.polarrose.spring.remoting.rest.annotations.RestAction;

public class RestActionUtils
{
    private RestActionUtils()
    {
    }

    //

    public static String getPathFromRestActionMethod(Method method)
    {
        String path = null;

        RestAction restAction = method.getAnnotation(RestAction.class);
        if (restAction == null || restAction.template().length() == 0) {
            path = "/" + method.getName();
        } else {
            path = restAction.template();
        }

        return path;
    }
}
